package com.sh.data.engine.domain.common.model.domain;

import y.base.Node;
import y.layout.LayoutGraph;
import y.layout.Layouter;

import java.util.Arrays;
import java.util.Comparator;

public class RowLayouter implements Layouter {
    private static final double DISTANCE = 0.0D;

    public boolean canLayout(LayoutGraph graph) {
        return (graph.edgeCount() == 0);
    }

    public void doLayout(LayoutGraph graph) {
        Node[] rows = graph.getNodeArray();
        Arrays.sort(rows, (Comparator<? super Node>) new Object());
        double currentY = 0.0D;
        for (int i = 0; i < rows.length; i++) {
            graph.setLocation(rows[i], 0.0D, currentY);
            currentY += graph.getHeight(rows[i]) + 0.0D;
        }
    }
}
